package com.bjpowernode.services;

import com.bjpowernode.beans.Value;
import com.bjpowernode.mapper.ValueMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.UUID;


@Service
public class ValueServicesImp implements ValueServices{

    @Autowired
    ValueMapper valueMapper;

    @Override
    public ArrayList<Value> getAll() {
        return valueMapper.getAll();
    }

    @Override
    public Value get(String id) {
        return valueMapper.get(id);
    }

    @Override
    public boolean add(Value value) {
        String id = UUID.randomUUID().toString().replace("-", "");
        value.setId(id);
        return valueMapper.add(value)>0?true:false;
    }

    @Override
    public boolean edit(Value value) {
        return valueMapper.edit(value)>0?true:false;
    }

    @Override
    public boolean del(String[] ids) {
        return  valueMapper.del(ids)>0?true:false;
    }
}
